package me.kagami.myjvm.jvm.opcode;

import me.kagami.myjvm.jvm.Frame;

import java.util.Arrays;

// See https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.ireturn
public class OpCode172ireturnHandler implements OpCodeInterface {
    @Override
    public int getOpCode() {
        return 172;
    }

    @Override
    public void handle(Frame frame) {
        System.out.println("BE OP:" + getOpCode() + " Stack:" + Arrays.toString(frame.getOperands()));
        Integer pop = frame.pop(Integer.class);
        frame.setReturnObj(pop);
        System.out.println("AF OP:" + getOpCode() + " Stack:" + Arrays.toString(frame.getOperands()));

    }
}
